<?php

namespace app\admin\validate\Coupon;

use think\Validate;

class Product extends Validate
{
    protected $rule = [
        'id'      => 'require',
        'name'    => 'require|max:25',
        'status'  => 'require|in:1,0',
        'sort'    => 'require|number|egt:1',
        'type_id' => 'require',
    ];

    protected $message = [
        'id.require'      => 'id错误！',
        'name.require'    => '品牌名称不能为空',
        'name.max'        => '品牌类型名称不能超过25个字符',
        'status.require'  => '状态不能为空',
        'status.in'       => '状态值只能是0,1',
        'sort.require'    => '排序不能为空',
        'sort.number'     => '排序必须是数字',
        'type_id.require' => '充值类型不能为空',
        'sort.egt'        => '排序必须大于等于1',
    ];

    protected $scene = [
        'add_product'  => ['name', "type_id", 'status', 'sort'],
        'edit_product' => ['id', 'name', "type_id", 'status', 'sort'],
        'set_status'   => ['id', 'status']
    ];
}
